package com.google.zxing.client.ohos.camera;

import ohos.agp.graphics.Surface;
import ohos.media.camera.device.Camera;
import ohos.media.camera.device.CameraStateCallback;

public class CameraStateImpl extends CameraStateCallback {
    private CameraManager cameraManager;
    private Surface surface;
    private int width;
    private int height;
    public CameraStateImpl(CameraManager manager,Surface surface,int width,int height){
        this.cameraManager = manager;
        this.surface = surface;
        this.width = width;
        this.height = height;
    }

    @Override
    public void onCreated(Camera camera) {
        super.onCreated(camera);
        cameraManager.tiggerLoopingCapture(camera,surface,width,height);
    }

    @Override
    public void onCreateFailed(String cameraId, int errorCode) {
        super.onCreateFailed(cameraId, errorCode);
    }

    @Override
    public void onConfigured(Camera camera) {
        super.onConfigured(camera);
        //开始帧捕获
    }

    @Override
    public void onReleased(Camera camera) {
        super.onReleased(camera);
    }

    @Override
    public void onFatalError(Camera camera, int errorCode) {
        super.onFatalError(camera, errorCode);
    }
}
